/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nurdrobotics;

import edu.wpi.first.wpilibj.*;

/**
 *
 * @author hpadmin
 */
public class LimitSwitch {

    protected DigitalInput di;

    public LimitSwitch(int portNumber) {
        if (portNumber > 0) {
            try {
                di = new DigitalInput(portNumber);
            } catch (NoClassDefFoundError e) {
            }
        }
    }

    public boolean isAvailable() {
        return di != null;
    }

    public boolean isOpen() {
        if (isAvailable()) {
            return di.get();
        } else {
            return false;
        }
    }

    public boolean isClosed() {
        return (!isOpen());
    }
}
